package com.atguigu.lease.common.exception;

import com.atguigu.lease.common.result.ResultCodeEnum;
import lombok.Data;

/**
 * @author gengjian
 * @date 2024/12/11 11:22:17
 * 自定义通用异常 主要为了可以传code
 */
@Data
public class LeaseException extends RuntimeException{

    private int code;

    public LeaseException(String message) {
        super(message);
    }


    public LeaseException(int code,String message) {
        super(message);
        this.code = code;
    }
    //重载一个
    public LeaseException(ResultCodeEnum resultCodeEnum){
        super(resultCodeEnum.getMessage());
        this.code = resultCodeEnum.getCode();
    }
}
